package com.gemcoder.system.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.Map;
import javax.annotation.Resource;
import com.gemcoder.system.bo.Result;
import com.gemcoder.system.service.InformationoverviewService;
import cn.hutool.core.util.StrUtil;
import java.util.Map;
import cn.hutool.core.util.ObjectUtil;

@Controller
@RequestMapping("/Informationoverview")
public class InformationoverviewController {

    @Resource
    private InformationoverviewService InformationoverviewService;

    @RequestMapping(value = "/addProject")
    @ResponseBody
    public Result addProject(@RequestBody(required = false) Map<String, Object> paramMap) {
        // 校验 ProjectNamevalue2
        if (paramMap.get("ProjectNamevalue2") == null || String.valueOf(paramMap.get("ProjectNamevalue2")).isEmpty()) {
            return new Result(false, "项目名称必填!", null);
        }
        // 校验 Watersourcevalue1
        if (paramMap.get("Watersourcevalue1") == null || String.valueOf(paramMap.get("Watersourcevalue1")).isEmpty()) {
            return new Result(false, "所属水源必填!", null);
        }
        // 校验 ProjectLocationvalue1
        if (paramMap.get("ProjectLocationvalue1") == null || String.valueOf(paramMap.get("ProjectLocationvalue1")).isEmpty()) {
            return new Result(false, "项目位置必填!", null);
        }
        // 校验 Billingmethodvalue2
        if (paramMap.get("Billingmethodvalue2") == null || String.valueOf(paramMap.get("Billingmethodvalue2")).isEmpty()) {
            return new Result(false, "计费方式必填!", null);
        }
        // 校验 StartDatevalue1
        if (paramMap.get("StartDatevalue1") == null || String.valueOf(paramMap.get("StartDatevalue1")).isEmpty()) {
            return new Result(false, "开始日期必填!", null);
        }
        // 校验 ProjectStatus1value1
        if (paramMap.get("ProjectStatus1value1") == null || String.valueOf(paramMap.get("ProjectStatus1value1")).isEmpty()) {
            return new Result(false, "项目状态必填!", null);
        }
        // 校验 OperationDirectorvalue1
        if (paramMap.get("OperationDirectorvalue1") == null || String.valueOf(paramMap.get("OperationDirectorvalue1")).isEmpty()) {
            return new Result(false, "运营厂长必填!", null);
        }
        // 校验 ContactInformationvalue1
        if (paramMap.get("ContactInformationvalue1") == null || String.valueOf(paramMap.get("ContactInformationvalue1")).isEmpty()) {
            return new Result(false, "联系方式必填!", null);
        }
        //调用service层的代码
        return InformationoverviewService.addProject(paramMap);
    }

    @RequestMapping(value = "/refreshProjectTable")
    @ResponseBody
    public Result refreshProjectTable(@RequestBody(required = false) Map<String, Object> paramMap) {
        //调用service层的代码
        return InformationoverviewService.refreshProjectTable(paramMap);
    }

    @RequestMapping(value = "/searchProjects")
    @ResponseBody
    public Result searchProjects(@RequestBody(required = false) Map<String, Object> paramMap) {
        //调用service层的代码
        return InformationoverviewService.searchProjects(paramMap);
    }

    @RequestMapping(value = "/getAllProjects")
    @ResponseBody
    public Result getAllProjects(@RequestBody(required = false) Map<String, Object> paramMap) {
        //调用service层的代码
        return InformationoverviewService.getAllProjects(paramMap);
    }

    @RequestMapping(value = "/getProjectsByPage")
    @ResponseBody
    public Result getProjectsByPage(@RequestBody(required = false) Map<String, Object> paramMap) {
        //调用service层的代码
        return InformationoverviewService.getProjectsByPage(paramMap);
    }

    @RequestMapping(value = "/terminateProject")
    @ResponseBody
    public Result terminateProject(@RequestBody(required = false) Map<String, Object> paramMap) {
        //调用service层的代码
        return InformationoverviewService.terminateProject(paramMap);
    }

    @RequestMapping(value = "/deleteDrugData")
    @ResponseBody
    public Result deleteDrugData(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.deleteDrugData(paramMap);
    }

    @RequestMapping(value = "/refreshDrugTable")
    @ResponseBody
    public Result refreshDrugTable(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.refreshDrugTable(paramMap);
    }

    @RequestMapping(value = "/addDrug")
    @ResponseBody
    public Result addDrug(@RequestBody(required = false) Map<String, Object> paramMap) {
        // 校验DrugNamevalue1是否存在且不为空
        if (paramMap.get("DrugNamevalue1") == null || String.valueOf(paramMap.get("DrugNamevalue1")).isEmpty()) {
            return new Result(false, "DrugNamevalue1必填", null);
        }
        // 校验Unitpriceyuantonvalue1是否存在且不为空
        if (paramMap.get("Unitpriceyuantonvalue1") == null || String.valueOf(paramMap.get("Unitpriceyuantonvalue1")).isEmpty()) {
            return new Result(false, "Unitpriceyuantonvalue1必填", null);
        }
        //调用service层的代码
        return InformationoverviewService.addDrug(paramMap);
    }

    @RequestMapping(value = "/refreshDrugTable6LK")
    @ResponseBody
    public Result refreshDrugTable6LK(@RequestBody(required = false) Map<String, Object> paramMap) {
        // 没有需要校验的入参
        //调用service层的代码
        return InformationoverviewService.refreshDrugTable6LK(paramMap);
    }

    @RequestMapping(value = "/getProjectDrugs")
    @ResponseBody
    public Result getProjectDrugs(@RequestBody(required = false) Map<String, Object> paramMap) {
        // 没有需要校验的入参
        //调用service层的代码
        return InformationoverviewService.getDrugsList(paramMap);
    }

    @RequestMapping(value = "/getProjectDetails")
    @ResponseBody
    public Result getProjectDetails(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.getProjectDetails(paramMap);
    }

    @RequestMapping(value = "/getProjectDetails0C2")
    @ResponseBody
    public Result getProjectDetails0C2(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.getProjectDetails(paramMap);
    }

    @RequestMapping(value = "/getProjectCount")
    @ResponseBody
    public Result getProjectCount(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.getProjectCount(paramMap);
    }

    @RequestMapping(value = "/getStartupProjectCount")
    @ResponseBody
    public Result getStartupProjectCount(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.getStartupProjectCount(paramMap);
    }

    @RequestMapping(value = "/getShutdownProjectCount")
    @ResponseBody
    public Result getShutdownProjectCount(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.getShutdownProjectCount(paramMap);
    }

    @RequestMapping(value = "/getTotalWaterYield")
    @ResponseBody
    public Result getTotalWaterYield(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.getTotalWaterYield(paramMap);
    }

    @RequestMapping(value = "/getYesterdaysWaterYield")
    @ResponseBody
    public Result getYesterdaysWaterYield(@RequestBody(required = false) Map<String, Object> paramMap) {
        //如果有需要校验的入参, 请在这里补充代码进行校验
        //调用service层的代码
        return InformationoverviewService.getYesterdaysWaterYield(paramMap);
    }
}
